home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wonky Flux Batch 2019 02
/
Wonky_Flux_Batch_2019-02.zip
/
Wonky Flux Batch 2019-02
/
072 - EXFER 4.1 4.2.dsk
/
EXFER.AUX.2.txt
next >
Wrap
Text File
|
2019-02-17
|
12KB
|
390 lines
;**********************
;* *
;* EXfer.aux.2 *
;* *
;**********************
; Written to fix the info problems and to provide a way
; to 'move' files to the correct directories, the actual
; moving of the files will not be done, but the file info
; and directory entry will be moved.
; This will also allow you to edit several things that
; were previously uneditable.
; To add this to your EXfer 4.1 add a '2' command to the
; list in EXFER.SEG.S with something like:
; if i$="2" and (info(5)) pop:link "a:exfer.aux.2"
; *** I used A1: instead of D: for the download drive specifier
; ------> jp Specifers Replaced (d: in place of a1:) 9-27-88
; WARNING: I wouldn't reccomend using this if you might lose
; carrier during the 'fix' routine, I have no idea
; of what damage could occur. Back-up your XV and
; DV files before using this program for the first
; time.
; Way back when version 1.2 came out there was a doc file that
; showed how the files were organized, since I am attempting to
; put in what I thought was left out, here they are, not in it's
; entirety, but enough to see what's happening.
; STRUCTURE OF THE XV.# FILES
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Filename: XV.n (were "N" is a library number)
; Contents: Library & download specific information
; Length: Each record is 32 bytes long
; Records 0 and 1 are combined to form one 64 byte record. These
; 64 bytes contain information relating to the overall volume and
; its operating parameters:
; RECORDS 0 & 1 (64 Bytes) - Library Information
; OFFSET DESCRIPTION PROGRAM REFERENCE
; ---------------------------------------------------------------
; Bytes 0-30: Directory name (padded) + [CR] BN$
; Bytes 31-35: U/D drive specifier + [CR] BF$
; ^^ about, the next five bytes are after the CR
; Byte 36: Access level B2 or BYTE(0)
; Byte 37: Download level B3 or BYTE(1)
; Byte 38: Upload level B4 or BYTE(2)
; Byte 39: Auto-validation flag (255=True) BYTE(3)
; Byte 40: Number of entries in this file BYTE(4)
; Bytes 41-42: Librarian high & low bytes B1 or BYTE(5)+BYTE(6)
; Byte 43: Upload credit UM or BYTE(7)
; Byte 44: Download credit DM or BYTE(8)
; Bytes 45-63: -- Unused --
; Following these first two records are file entries, which occupy
; records 2 up to 254:
; RECORDS 2 - X (32 bytes each) - File entries
; OFFSET DESCRIPTION PROGRAM REFERENCE
; ----------------------------------------------------------------
; Bytes 0-15: Filename (Padded) + [CR] F$
; Bytes 16-19: Filetype + [CR] TY$
; Byte 20: File validity BYTE(9)
; Bytes 21-22: File size, high & low bytes BYTE(10)+BYTE(11)
; Bytes 23-24: Uploader #, high & low bytes BYTE(12)+BYTE(13)
; Bytes 25-26: Description #, high & low bytes BYTE(14)
; Bytes 27-28: Date file was uploaded WHEN$
; Byte 29: # of times downloaded BYTE(18)
; Bytes 30-31: -- Unused --
; NOTE: The description allows more than 255 descriptions, but
; there can be only 254 files in the library, strange...
ready d2$
prompt
on nocar goto terminate
x=(clock(2)-clock(1))/60:x$=right$("0"+str$(x),2)
if x=0 then x$="--":else if (info(5)) or (clock(1)=0) then x$="::"
free:clear key:print \"["x$"] Aux.2 ->";
if zz=1 then zz=0:goto command
if zz=3 goto command:else get i$:print chr$(8)" ";chr$(8);
; check for normal command
command
push prompt
if i$="F" pop:goto fixit
if i$="M" goto moveit
if i$="E" goto edinfo
if i$="?" or i$="/" goto help
if i$="Q" pop:link "a:exfer.seg","prompt"
; not a command
print " "chr$(8);:return
help
print\\'
*********************
* Exfer.aux.2 *
* by David Kirsch *
*-------------------*
* F)ix info files *
* M)ove file *
* E)dit entry *
* Q)uit *
*********************
'\\:return
; Fix the info file
; ~~~~~~~~~~~~~~~~~
fixit
print "Fix"
print \\"Checking entries against infos"
store "d:var2"
on nocar:
print \"File entries = "d1$
print "Info file = "d2$
close
ready d2$
open #1,d1$: for l=1 to byte(4):f$=""
position #1,32,l+1:input #1,f$:input #1,ty$
position #1,32,l+1,20:read #1,ram2+9,10:if f$="" next:goto fix.1
if not(byte(14)) next:goto fix.1
input #msg(byte(14)),z:input #6,i$
if f$=i$ next:goto fix.1
print l+1". "f$" "i$
byte(14)=0:byte(15)=0:na$=f$:nb=l:close:gosub write:open #1,d1$
next
; fix bad messages (info)
fix.1
close
print \\"Checking for bad infos"
for i=1to msg(0)
if not(msg(i)) next goto fix.2
input #msg(i),z:input #6,i$
if len(i$)=15 next:goto fix.2
print i
kill #msg(i):update
next
; Fix the remaining infos
fix.2
print \\"Checking remaining info against entries"
for i=1to msg(0)
if not(msg(i)) next:goto fix.done
input #msg(i),z:input #6,i$
gosub read
if l=0 kill #msg(i):update:print i$" not found.":next:goto fix.done
if byte(14)=i next:goto fix.done
if byte(14) kill #msg(i):update:print i$" duplicate deleted":next:goto fix.done
byte(14)=i:byte(15)=0:na$=f$:nb=l:gosub write
print f$" added."
next
fix.done
close
recall "d:var2":kill "d:var2"
goto prompt
; Move entry (& info) to another library
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
moveit
d=0:input @2 \"Move file: " i$:if i$="" return:else na$=i$
if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto move1
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) goto nfile
move1
if l<0 goto nfile
kill "d:temp":create "d:temp":open #1,"d:temp"
print #1,f$:print #1,ty$:for i=9 to 18:print #1,byte(i):next
d=byte(14):if d copy #msg(d),#1
close
move2
print "Copy "f$" from library "bb
input @2" to library [?]..." i$:if i$="" return
if i$="?" goto move3:else a=val(i$)
if (a<1) or (a>255) print \"XT: "chr$(7)"That library doesn't exist":return
ob=bb:bb=a:gosub log:if bf$="" then l=bb:gosub biterr:print '
XT: 'chr$(7)"That library doesn't exist":bb=ob:goto log
i$=f$:gosub read
if l print "Duplicate file name"chr$(7):bb=ob:goto log
gosub getslt:if nb=255 gosub dfull:bb=ob:goto log
open #1,"d:temp"
input #1,f$:input #1,ty$
for i=9 to 18: input #1,x:byte(i)=x:next:d=byte(14)
if d a=1:gosub findinfo:byte(14)=d:copy #1,#msg(d):msg(d)=255:update
close:kill "d:temp":na$=f$:if nb<>byte(4) gosub write:else gosub update
bb=ob:goto log
move3
print screen$"XT: You may access the following..."\\s$\
open #1,"d:xt.bitmap":read #1,ed+1,255:close
open #1,"d:xt.volumes":for l=1 to 255
setint(1):x=peek(ed+l):if key(1) then l=255:next:goto move3.1
if x>34 next:goto move3.1
position #1,32,l:input #1,x$
print "["right$("00"+str$(l),3)"]: "x$:next
move3.1
close:setint(""):print:clear key:goto move2
; Edit the uneditable info & directory entry
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
edinfo
d=0:input @2 \"Edit file: " i$:if i$="" return:else na$=i$
if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto editit
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) goto nfile
editit
print \"(I)nfo or (E)ntry: ";:get i$
if i$="I" or i$="i" goto edin.x
if i$="E" or i$="e" goto edentry
return
edin.x
if l<0 goto nfile:else c=byte(12)+byte(13)*256:d=byte(14)
if not(d) print xt$;chr$(7)"File has no information":return
input #msg(d),a:input #6,x$\y$\z$:copy #6,#8
edin.2
print \\"A. Uploaded by: User #"a
print "B. Filename: "x$
print "C. "y$
print "D. "z$
print \"A-D: ";:input @2 i$
if i$="A" input "User #" a:goto edin.2
if i$="B" input "Filename: " x$:goto edin.2
if i$="C" input "Uploader: " y$:y$="Uploader: "+y$:goto edin.2
if i$="D" input "Uploaded: " z$:z$="Uploaded: "+z$:goto edin.2
print "Save (y/N): ";:get i$:if i$<>"Y" and i$<>"y" return
edit(0)
input #msg(d),i:input #6,i$\i$\i$\i$:copy #6,#8:kill #msg(d)
print #msg(d),a:print #6,x$\y$\z$\:copy #8,#6
msg(d)=255:update:close:return
edentry
print \\"A. Filename: "f$
print "B. File type: "ty$
print "C. Valid file: ";:if byte(9) print "YES": else print "NO"
print "D. Uploader # "byte(12)+byte(13)*256
print "E. Date: "when$" (updates to current date)"
print "F. Downloaded "byte(18)" times."
print \"A-F: ";:input @2 i$
if i$="A" input "Filename: " f$:goto edentry
if i$="B" input "File type: " ty$:goto edentry
if i$="C" byte(9)=not(byte(9)):goto edentry
if i$="D" input "Uploader #" a:byte(13)=a/256:byte(12)=a mod 256:goto edentry
if i$="E" print "Date: " date$: when$ = "x": goto edentry
if i$="F" input "Downloaded: " a:byte(18)=a:goto edentry
print "Save (y/N): ";:get i$:if i$<>"Y" and i$<>"y" return
na$=f$:nb=l:goto write
return
; SUBROUTINE - find an empty message entry
findinfo
if msg(a) then a=a+1:else d=a:return
if a>msg(0) then d=a:return
goto findinfo
; Terminate connection
; ~~~~~~~~~~~~~~~~~~~~
terminate
byte=ram2:byte(0)=xm+(pt*8):byte(1)=1:byte(2)=cr mod 256:byte(3)=cr/256
open #1,"d:xt.users":position #1,4,un:write #1,ram2,4:close
poke ram2,v:when$=ram+20:if v=0 then byte=ram+29:goto term.1
byte=ram+37:nibble(3)=dl/256:byte(3)=dl mod 256
nibble(4)=ul/256:byte(4)=ul mod 256
term.1
clear:recall "a:variables":kill "a:variables"
if x=13 then ul=byte(4)+nibble(4)*256:dl=byte(3)+nibble(3)*256
link "a:main.seg","termin2"
; :::::::::::::
; directory I/O
; :::::::::::::
; log to a library and get some dir info
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log
byte=ram2:fill ram2,32,0:bf$="":z$="d:xv."+str$(bb)
open #1,z$:input #1,bn$:input #1,bf$
read #1,ram2,9:close:b1=byte(5)+byte(6)*256
b2=1:if byte(0) then b2=flag(byte(0))
b3=1:if byte(1) then b3=flag(byte(1))
b4=1:if byte(2) then b4=flag(byte(2))
um=byte(7):dm=byte(8):lb=(un=b1)
if info(5) then lb=1:b2=1:b3=1:b4=1
d1$="d:xv."+str$(bb):d2$="d:dv."+str$(bb)
if bf$ ready d2$:bf$=left$(bf$,instr(":",bf$))
return
; get an empty slot
; ~~~~~~~~~~~~~~~~~
getslt
nb=0:open #1,d1$:for l=1 to byte(4)
position #1,32,l+1:input #1,i$
if (i$="") and (nb=0) then nb=l:l=byte(4)
next:close:if not(nb) then nb=byte(4)
return
; update "number of entries" counter
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update
byte(4)=byte(4)+1:open #1,d1$:print #1,bn$
print #1,bf$:write #1,ram2,9:close
; write a directory entry
; ~~~~~~~~~~~~~~~~~~~~~~~
write
open #1,d1$:position #1,32,nb+1:print #1,na$
print #1,ty$:write #1,ram2+9,10:close
z=nb:return
; read a directory entry
; ~~~~~~~~~~~~~~~~~~~~~~
read
open #1,d1$:for l=1 to byte(4)
position #1,32,l+1:input #1,f$
if instr(i$,f$)=1 then p=l:l=byte(4):next:l=p:goto read.1
next:close #1:l=0:return
read.1
input #1,ty$:read #1,ram2+9,10:close #1
return
; read a file by slot #
; ~~~~~~~~~~~~~~~~~~~~~
nread
if left$(i$,1)="#" then i$=mid$(i$,2)
l=val(i$):if (l<2) or (l>253) then l=0:return
open #1,d1$:position #1,32,l
input #1,f$:if f$="" close #1:l=0:return
input #1,ty$:read #1,ram2+9,10:close #1
i$=f$:if pt=2 return:else print \"[#"l"]: "i$:return
; :::::::::::::::::::::::::
; miscellaneous subroutines
; :::::::::::::::::::::::::
; update errant bit-map
; ~~~~~~~~~~~~~~~~~~~~~
biterr
open #1,"d:xt.bitmap":read #1,ed+1,255:close
poke ed+l,255:open #1,"d:xt.bitmap"
write #1,ed+1,255:close:open #1,"d:xt.volumes"
position #1,32,l:print #1,chr$(13):close
return
; ::::::::::::::
; error messages
; ::::::::::::::
dfull
print xt$;chr$(7)" Directory full...":return
nfile
print xt$;chr$(7)" No such file...":return